package impl

import (
	"context"
	"github.com/starmotioncf/common/region"
	"github.com/starmotioncf/soutchatinternal/model"
	"github.com/starmotioncf/soutchatinternal/repository"
)

type thirdGameRepository struct {
	*repository.Repository
}

func NewThirdGameRepository(repo *repository.Repository) repository.ThirdGameRepository {
	return &thirdGameRepository{
		Repository: repo,
	}
}

func (r *thirdGameRepository) GetListByRegion(ctx context.Context, rgn region.Region) (m []*model.ThirdGame, err error) {
	err = r.DB(ctx).Where("region = ? and status = 1", rgn).Order("hot desc").Order("sort asc").Find(&m).Error
	return
}
